[#import "/framework/JGP.htm"  as JGP]
<!--
项目   jgp-cloud-parent
作者   LOUFEI [Gavin]
时间   2018/11/8
-->
[@JGP.head "Title"/]
[@JGP.body]
<jgp-form _id="pay-config-form" slot="2-1">
    <jgp-div _row="['30','180','*']" _runit="px">
        <div slot="1-1">
            <jgp-btn _fn="saveFn">保存</jgp-btn>
        </div>

        <jgp-form-group slot="2-1" _title="选择支付方式" _label_width="100px">
            <jgp-drop _label="方式" _name="paymentConfig.mode" _col="6"
                      _not_input="true"
                      _active_key="SYS.DROP.PAYMENT.TYPE" _value="ALI"
                      _onchange="selectPayModeFn"></jgp-drop>
            <jgp-area _label="说明" _name="paymentConfig.remark" _col="12"
                      _required="true"></jgp-area>
        </jgp-form-group>
        <div slot="3-1">
            <jgp-slider _id="pay-mode-slider" _list="['ALI','WX','YL']" _page="ALI">
                <div slot="ALI">
                    <jgp-form-group _title="支付宝基本配置" _label_width="100px">
                        <jgp-text _label="APPID" _name="aliPaymentParam.appId" _placeholder="请填写应用ID"
                                  _required="true" _col="12"></jgp-text>
                        <jgp-area _label="商户私钥" _name="aliPaymentParam.merchantPrivateKey"
                                  _placeholder="请填写商户私钥"
                                  _required="true" _col="6" _row="5"></jgp-area>
                        <jgp-area _label="支付宝公钥" _name="aliPaymentParam.alipayPublicKey"
                                  _placeholder="请填写支付宝公钥"
                                  _required="true" _col="6" _row="5"></jgp-area>
                        <jgp-text _label="支付网关" _name="aliPaymentParam.gatewayUrl" _placeholder="请填写支付宝网关"
                                  _required="true" _col="12"
                                  _value="https://openapi.alipaydev.com/gateway.do"></jgp-text>
                        <jgp-text _label="服务网关" _name="aliPaymentParam.partnerServiceGateWay" _placeholder="支付宝提供给商户的服务接入网关"
                                  _required="true" _col="12"
                                  _value="https://mapi.alipay.com/gateway.do"></jgp-text>
                    </jgp-form-group>
                    <jgp-form-group _title="回调配置" _label_width="100px">
                        <jgp-text _label="回调域名" _name="paymentConfig.domain"
                                  _placeholder="回调域名:(http|https)://[jgp.com 或者 pay.jgp.com]"
                                  _required="true" _col="12"></jgp-text>
                    [#--<jgp-hidden _label="异步通知页" _name="aliPaymentParam.notifyUrl"
                              _placeholder="请填写服务器异步通知页面路径" _value="/third/pay/aliPayApiController/payNotify"
                              _required="true" _col="12"></jgp-hidden>
                    <jgp-hidden _label="同步通知页" _name="aliPaymentParam.returnUrl"
                              _placeholder="请填写页面跳转同步通知页面路径" _value="/third/pay/aliPayController/payReturn"
                              _required="true" _col="12"></jgp-hidden>--]
                    </jgp-form-group>
                    <jgp-form-group _title="企业支付宝账号配置" _label_width="100px">
                        <jgp-text _label="商户ID" _name="aliPaymentParam.partner" _placeholder="商户ID"
                                  _required="true" _col="12"></jgp-text>
                        <jgp-text _label="企业账号" _name="aliPaymentParam.account" _placeholder="请填写企业支付宝账号"
                                  _required="true" _col="12"></jgp-text>
                        <jgp-text _label="所有人姓名" _name="aliPaymentParam.accountName" _placeholder="请填写企业支付宝所有人姓名"
                                  _required="true" _col="12"></jgp-text>
                    </jgp-form-group>
                </div>

                <div slot="WX">
                    <jgp-form-group _title="基础配置">
                    </jgp-form-group>
                    <jgp-form-group _title="跳转访问配置" _label_width="100px">
                    </jgp-form-group>

                </div>
            </jgp-slider>
        </div>

    </jgp-div>


[/@JGP.body]

[@JGP.foot]
    <script>

        var configId = '${configId!''}';

        JGP.$onload(function () {
            var form = JGP.form('pay-config-form');
            if (configId != '') {
                JGP.$post('/third/pay/paymentConfigApiController/queryPaymentConfigById', {configId: configId},
                        function (result) {
                            form.setFdata(result.data.fdata);
                        })
            }
        })

        function selectPayModeFn(param) {
            var page = param.back.value;
            JGP.slider('pay-mode-slider').goPage(page);
        }

        function saveFn() {
            var form = JGP.form('pay-config-form');
            var page = JGP.slider('pay-mode-slider').getCurrent();
            form.ajaxSubmitTo('/third/pay/paymentConfigApiController/savePaymentConfig', function (result) {
                if (result.flag) {
                    JGP.$close(result.flag);
                } else {
                    JGP.$error(result.msgs[0]);
                }
            })
        }

        function checkUniqueFn(param) {
            JGP.$post('/third/pay/payApiController/checkCodeUnique', {'code': param.back}, function (result) {
                console.log(result);
            })
        }
    </script>
[/@JGP.foot]